package day20.feifei;

import java.util.concurrent.*;

public class Danli {
    public static void main(String[] args) throws Exception {
        ExecutorService threadPool = Executors.newCachedThreadPool();
        for(int i=0;i<5;i++){
            Future<People> future = threadPool.submit(new Callable<People>() {
                @Override
                public People call() throws Exception {
                    return People.getInstance();
                }
            });
            People people = future.get();
            System.out.println(people);
        }
        People people=People.getInstance();
        System.out.println(people);
threadPool.shutdown();
    }
}
class People{
    private static People people=null;
    private People(){}
    public static People getInstance() {
        if (people == null) {
            people =new People();
        }
        return people;
    }
}